package com.handong.handdemo.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;

public class SPUtil {

    public static final String USER_PASSWORD = "user_password";
    //任务列表页。
    public static final String USER_NAME = "user_name";
    public static final String LOGIN_CODE = "login_code";
    public static final String PHONE_NAME = "phone_name";
    public static final String FIRST_BOOT = "first_boot";
    public static final String NAV_INDEX = "nav_index";
    public static final String NAV_TITLE_NAME = "nav_title_name";

    public static final String MISSION_ID = "mission_id";
    public static final String MISSION_PORT = "mission_port";
    public static final String RING_STATUS = "ring_status";
    public static final String SERVER_IP = "server_ip";
    public static final String FOOTRING_SERVER_IP = "footring_server_ip";
    public static final String SETTING_DISTANCE = "setting_distance";
    private static final String TAG = "SP";
    public static final String UPLOAD_PORT = "upload_port";
    public static final String CHAT_PORT="chat_port";
    public static final String FILE_PORT="file_port";
    public static final String VIDEO_PORT="video_port";
    public static final String FOOT_PORT="foot_port";
    public static final String COMPANY_CODE = "sys_companycode";

    public static final String CATCH_MODE_TIP = "catch_mode_tip";
    public static final String IMEI_CRC = "imei_crc";
    public static final String PASS_WORD="pass_word";

    public static final String STOP_MISSION_SET_DISTANCE = "stop_mission_set_distance";

    @SuppressLint("StaticFieldLeak")
    public static  Context mContext;

    public static boolean getBooleanValue(String paramString) {
        return mContext.getSharedPreferences(TAG, 0).getBoolean(paramString, false);
    }

    public static float getFloatValue(String paramString) {
        return mContext.getSharedPreferences(TAG, 0).getFloat(paramString, 0.0F);
    }

    public static int getIntValue(String paramString) {
        return mContext.getSharedPreferences(TAG, 0).getInt(paramString, 0);
    }

    public static String getStringValue(String paramString) {
        return mContext.getSharedPreferences(TAG, 0).getString(paramString, "");
    }

    public static String getStringValue(String paramString, String defaultString) {
        return mContext.getSharedPreferences(TAG, 0).getString(paramString, defaultString);
    }

    public static void initSP(Context paramContext) {
        if (mContext == null) {
            mContext = paramContext.getApplicationContext();
        }
    }

    public static void putBooleanValue(String paramString, boolean paramBoolean) {
        SharedPreferences.Editor localEditor = mContext.getSharedPreferences(TAG, 0).edit();
        localEditor.putBoolean(paramString, paramBoolean);
        localEditor.commit();
    }

    public static void putFloatValue(String paramString, float paramFloat) {
        SharedPreferences.Editor localEditor = mContext.getSharedPreferences(TAG, 0).edit();
        localEditor.putFloat(paramString, paramFloat);
        localEditor.commit();
    }

    public static void putIntValue(String paramString, int paramInt) {
        SharedPreferences.Editor localEditor = mContext.getSharedPreferences(TAG, 0).edit();
        localEditor.putInt(paramString, paramInt);
        localEditor.commit();
    }

    public static void putStringValue(String paramString1, String paramString2) {
        SharedPreferences.Editor localEditor = mContext.getSharedPreferences(TAG, 0).edit();
        localEditor.putString(paramString1, paramString2);
        localEditor.commit();
    }

    public static void remove(String paramString) {
        SharedPreferences.Editor localEditor = mContext.getSharedPreferences(TAG, 0).edit();
        localEditor.remove(paramString);
        localEditor.commit();
    }
}
